import { Nodes } from '@knno/dom';
import { SplitBar as UISplitBar, SplitBarType, SplitBarEventMap } from '../components/splitBar/splitBar';
import { JSXProps } from '@knno/dom/jsx';
import { AttrCheck, On, isBool, isStr, jsxBuild } from './utils';

export { UISplitBar };

interface SplitBarProps extends JSXProps<UISplitBar>, On<SplitBarEventMap, UISplitBar> {
	type?: SplitBarType;
	disabled?: boolean;
}

const ATTRS: AttrCheck = {
	type: isStr,
	disabled: isBool,
};

export function SplitBar(props: SplitBarProps, children: Nodes[]): UISplitBar {
	return jsxBuild(new UISplitBar(), props, children, ATTRS);
}
